home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / misc / RapidFire.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.8 KB  |  71 lines

  1. class classes.misc.RapidFire
  2. {
  3.    var cMax;
  4.    var big;
  5.    var c = 0;
  6.    var c2 = 0;
  7.    var c2Max = 20;
  8.    var Name = "rapidFire";
  9.    function RapidFire(max, pbig)
  10.    {
  11.       this.cMax = max;
  12.       this.big = pbig;
  13.       if(!this.big)
  14.       {
  15.          _root.rapidVar = 2;
  16.       }
  17.       else
  18.       {
  19.          _root.rapidVar = 3;
  20.       }
  21.    }
  22.    function main()
  23.    {
  24.       this.c = this.c + 1;
  25.       if(!this.big)
  26.       {
  27.          _root[_root.char].fireFreq = 3 + Math.round(this.c / (this.cMax / 6));
  28.       }
  29.       else
  30.       {
  31.          _root[_root.char].fireFreq = 4 + Math.round(this.c / (this.cMax / 6));
  32.       }
  33.       if(this.c == this.cMax)
  34.       {
  35.          _root[_root.char].fireFreq = _root[_root.char].fireFreqOrig;
  36.          if(!this.big)
  37.          {
  38.             _root.rapidVar = 3;
  39.          }
  40.          else
  41.          {
  42.             _root.rapidVar = 4;
  43.          }
  44.          _root.currentBoost = "";
  45.          _root.removePowerUp("rapidFire");
  46.       }
  47.       if(this.c < this.cMax / 3 && _root[_root.char].fire)
  48.       {
  49.          this.c2 = this.c2 + 1;
  50.          this.c2Max /= 1.04;
  51.          if(this.c2 >= Math.ceil(this.c2Max) + 1)
  52.          {
  53.             _root["gunSmoke" + this.c] = new classes.fx.GunSmoke(_root[_root.char].shotX,_root[_root.char].shotY,this.c);
  54.             _root.addFX("gunSmoke" + this.c);
  55.             this.c2 = 0;
  56.          }
  57.       }
  58.       else if(this.c > this.cMax / 3 && _root[_root.char].fire)
  59.       {
  60.          this.c2 = this.c2 + 1;
  61.          this.c2Max *= 1.03;
  62.          if(this.c2 >= Math.ceil(this.c2Max) + 1)
  63.          {
  64.             _root["gunSmoke" + this.c] = new classes.fx.GunSmoke(_root[_root.char].shotX,_root[_root.char].shotY,this.c);
  65.             _root.addFX("gunSmoke" + this.c);
  66.             this.c2 = 0;
  67.          }
  68.       }
  69.    }
  70. }
  71.